package com.xdf.ecommerce.converter;

import com.xdf.ecommerce.constant.GoodsStatus;
import javax.persistence.AttributeConverter;

/**
 * javax.persistence.AttributeConverter 依赖 javax.persistence-api
 * @author chanchaw
 * @create 2025-10-27 19:18
 */
public class GoodsStatusConverter implements AttributeConverter<GoodsStatus, Integer>{
    @Override
    public Integer convertToDatabaseColumn(GoodsStatus goodsStatus) {
        return goodsStatus.getId();
    }

    @Override
    public GoodsStatus convertToEntityAttribute(Integer integer) {
        return GoodsStatus.of(integer);
    }
}
